package com.alibaba.citrus.ots.sales.plan.functions.salesplan;

import com.alibaba.citrus.ots.sales.plan.repository.SalesPlanLineRepository;
import com.alibaba.citrus.ots.sales.plan.sdo.SalesPlanLineSDO;
import lombok.Getter;
import lombok.Setter;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author luyi
 * @date 2021/9/17 11:18 下午
 */
@Component
public class SalesPlanLineAbility {
    @Getter
    @Setter
    private SalesPlanLineSDO salesPlanLineSDO;

    @Resource
    private SalesPlanLineRepository salesPlanLineRepository;

/*    *//**
     * 批量新增月度计划明细
     *
     * @param salesPlanLineSDOList
     * @return
     *//*
    public Boolean batchCreateSalesPlanLine(List<SalesPlanLineSDO> salesPlanLineSDOList) {
        salesPlanLineSDOList.forEach(it -> {
            SalesPlanLineEntity planLineEntity = SalesPlanLineEntity.of(it);
            planLineEntity.doCreate();
        });
        return true;
    }*/

    /**
     * 批量新增月度计划明细
     *
     * @param ids
     * @return
     */
    public Boolean batchDeleteByIds(List<Long> ids) {
        ids.forEach(it -> {
            SalesPlanLineSDO sdo = SalesPlanLineSDO.builder().id(it).build();
            SalesPlanLineEntity planLineEntity = SalesPlanLineEntity.of(sdo);
            planLineEntity.doDelete();
        });
        return true;
    }

    /**
     * 创建月度计划后 模版操作
     *
     * @param
     * @return
     */
    Boolean salesPlanTemplate() {

        return true;
    }

//    /**
//     * 月度计划明细变更汇总
//     * @param salesPlanLine
//     * @return
//     */
//    Boolean salesPlanStat(SalesPlanLineSDO salesPlanLine){
//
//        return true;
//    }
//
//
//    /**
//     * 删除计划客户
//     * @param deletePlanCustomerAbilityRequest
//     * @return
//     */
//    Boolean deletePlanCustomer(DeletePlanCustomerAbilityRequest deletePlanCustomerAbilityRequest){
//
//        return true;
//    }
//
//    /**
//     * 删除计划货品
//     * @param deletePlanScItemAbilityRequest
//     * @return
//     */
//    Boolean deletePlanScItem(DeletePlanScItemAbilityRequest deletePlanScItemAbilityRequest){
//
//        return true;
//    }

    public String batchCreateSalesPlanLine(List<SalesPlanLineSDO> salesPlanLineSDOList) {
        return salesPlanLineRepository.batchCreateSalesPlanLine(salesPlanLineSDOList);
    }

}
